{__NOLAYOUT__}
<html><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>用户中心</title>
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/agent/css/public.css" />
    <link rel="stylesheet" type="text/css" href="/agent/css/user.css"/>
    <script type="text/javascript" src="/agent/js/jquery.js" ></script>
    <script type="text/javascript" src="/agent/js/rem.js" ></script>
</head>
<body class="body_tj" style="background-color: #F5F5F5;">

<div id="tbh5v0">
    <div class="address_top"></div>

    {if $list}
    {volist name="list" id="data"}
    <div class="address_add del_{$data.id}">
        <dl class="selectedAddress" data-id="{$data.id}" data-name="{$data.name}" data-tel="{$data.tel}" data-address="{$data.province_text}{$data.city_text}{$data.area_text}{$data.address}">
            <dt>
                <strong>&nbsp;{$data.name}</strong>
                <span>{$data.tel}</span>
            </dt>
            <dd>{$data.province_text}{$data.city_text}{$data.area_text}{$data.address}</dd>
        </dl>
        <div class="address_bottom">
            <div class="add_l" data-id="{$data.id}">
                <input type="radio" name="checkradio" {$data.status == 1 ? 'checked' : ''} value="" />
                <em>设为默认地址</em>
            </div>
            <div class="add_r" >
                <a href="/agent/agent/editAddress/id/{$data.id}"><span>编辑</span></a>
                <a class="delete" data-id="{$data.id}" href="javascript:void(0);" onclick="if (confirm('你确认要删除该收货地址吗？')) location.href='#'"><em>删除</em></a>
            </div>
        </div>
    </div>
    {/volist}
    {else}
    没有收货地址
    {/if}
</div>

<div style=" width:100%; height:50px;"></div>
<div class="list_footer">
    <a href="/agent/agent/addAddress?url={$Request.root}{$Request.url}">添加新地址</a>
</div>



<script language="javascript">
  $(function(){
    //设置收货地址
    $('.add_l').click(function () {
      var id = $(this).attr('data-id');
      $.ajax({
        type:'post',
        url:'/agent/agent/upAddress',
        data:{id:id},
        success:function (data) {
          if(data.code != 1){}
        }
      });
    });
  });
    //删除
  $('.delete').click(function(){
    var id = $(this).attr('data-id');
    $.ajax({
      type:'post',
      url:'/agent/agent/delAddress',
      data:{id:id},
      success:function (data) {
        if(data.code == 1)
        {
          $('.del_'+data.data).remove();
        }
      }
    });
  });
</script>

</body></html>